<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        body {
            color: grey;
        }
    </style>
</head>

<body>
    <script type="text/javascript">
        //构造函数模式 
        //小明 今年18岁 性别男 有男朋友 男朋友会说话 说什么自己定
        function Person(name, age, sex, hasbf, bfsay, say) {
            this.name = name;
            this.age = age;
            this.sex = sex;
            this.hasbf = hasbf;
            this.bfsay = bfsay;
            this.say = say;
            document.write(this.name + "公元二零一七年" + this.age + "岁," + "性别:" + this.sex + this.hasbf + this.bfsay + this.say)
        }
        var person = new Person("小明", 26, "女", "有男朋友", "男朋友想说话", "但是男朋友不想说话")
            //工厂模式
            //造一辆车 出厂 （合格证/建议零售价/说明书）
        function vehicle(name, time, product, price, specification) {
            var vehicleData = new Object();
            vehicleData.name = name;
            vehicleData.time = time;
            vehicleData.product = product;
            vehicleData.price = price;
            vehicleData.specification = specification;
            vehicleData.dataName = function() {
                document.write(this.name + "出厂时间：" + this.time + "合格证：" + this.product + "建议零售价：" + this.price + "说明：" + this.specification)
            }
            return vehicleData;
        }

        var car = vehicle("汗血", "2017/7/25", "QS", "1888888K", "超级环保，生态卫生,从我做起!")
        car.dataName();
    </script>
</body>

</html>